<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card margin-bottom-0 overhide" data-auto="true" method="post">
    <div class="layui-card-body padding-left-40">
        <fieldset>
            <legend><span class="layui-badge layui-bg-cyan">收货信息</span></legend>
            <div class="layui-form-item layui-row layui-col-space10">
                <label class="layui-col-xs6 relative block">
                    <span class="color-green font-w7 label-required-prev">收货人姓名</span>
                    <span class="color-desc margin-left-5">User Name</span>
                    <input class="layui-input" name="address_name" placeholder="请输入收货姓名" required value="{$vo.address_name|default=''}">
                </label>

                <label class="layui-col-xs6 relative block">
                    <span class="color-green font-w7 label-required-prev">收货人手机</span>
                    <span class="color-desc margin-left-5">User Mobile</span>
                    <input class="layui-input" name="address_phone" placeholder="请输入收货人手机" required value="{$vo.address_phone|default=''}">
                </label>

                <div class="layui-col-xs12 relative block">
                    <span class="color-green font-w7 label-required-prev">收货所在区域</span>
                    <span class="color-desc margin-left-5">（原区域：{$vo.address_province|default='--'} - {$vo.address_city|default=''} - {$vo.address_area|default=''} ）</span>
                    <div class="layui-row layui-col-space10">
                        <label class="layui-col-xs4"><select class="layui-select" lay-filter="form_province" name="form_province"></select></label>
                        <label class="layui-col-xs4"><select class="layui-select" lay-filter="form_city" name="form_city"></select></label>
                        <label class="layui-col-xs4"><select class="layui-select" lay-filter="form_area" name="form_area"></select></label>
                    </div>
                </div>

                <label class="layui-col-xs12 relative block">
                    <span class="color-green font-w7 label-required-prev">收货详细地址</span>
                    <span class="color-desc margin-left-5">（原地址：{$vo.address_content|default=""} )</span>
                    <input class="layui-input" name="address_content" placeholder="请输入收货地址" required value='{$vo.address_content|default=""}'>
                </label>
            </div>
        </fieldset>

        <fieldset class="margin-top-20">
            <legend>
                <span class="layui-badge layui-bg-cyan">快递信息</span>
                <span class="layui-badge layui-bg-blue pointer" data-express-query>快递跟踪</span>
            </legend>
            <label class="layui-form-item relative block">
                <span class="color-green font-w7 label-required-prev">快递配送公司</span>
                <span class="color-desc margin-left-5">Express Company</span>
                <select class="layui-select" data-truck-code lay-search name="company_code">
                    {foreach $items as $item}{if isset($vo.company_code) and $vo.company_code eq $item.code_1}
                    <option selected value="{$item.code_1}">{$item.name} ( {$item.code_1} )</option>
                    {else}
                    <option value="{$item.code_1}">{$item.name} ( {$item.code_1} )</option>
                    {/if}{/foreach}
                </select>
            </label>

            <label class="layui-form-item relative block">
                <span class="color-green font-w7 label-required-prev">快递配送单号</span>
                <span class="color-desc margin-left-5">Express Number</span>
                <input class="layui-input" data-truck-number name="send_number" placeholder="请输入快递配送单号" required value='{$vo.send_number|default=""}'>
            </label>

            <label class="layui-form-item relative block">
                <span class="color-green font-w7">快递配送描述</span>
                <span class="color-desc margin-left-5">Express Description</span>
                <textarea class="layui-textarea" name="send_remark" placeholder="请输入快递配送描述">{$vo.send_remark|default=""}</textarea>
            </label>
        </fieldset>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.order_no'}<input name='order_no' type='hidden' value='{$vo.order_no}'>{/notempty}
    {notempty name='vo.send_datetime'}<input name='send_datetime' type='hidden' value='{$vo.send_datetime}'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" data-close data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
    </div>

    <script>
        require(['pcasunzips'], function () {
            (function (prov, city, area, refresh) {
                new PCAS("form_province", "form_city", "form_area", prov, city, area);
                refresh(), form.on('select(form_province)', refresh), form.on('select(form_city)', refresh), form.on('select(form_area)', refresh);
            })('{$vo.address_province|default=""}', '{$vo.address_city|default=""}', '{$vo.address_area|default=""}', function (data) {
                (data && $(data.elem).trigger('change')), setTimeout(function () {
                    layui.form.render();
                }, 100);
            });
        });

        $('[data-express-query]').on('click', function () {
            (function (code, number) {
                $.form.modal('{:url("shop.send/query")}', {code: code, number: number}, '快递追踪查询')
            })($('[data-truck-code]').val(), $('[data-truck-number]').val());
        });
    </script>
</form>